 <template>
   <div>
    <el-dialog :visible="previewDialog" title="预览文章" :close-on-click-modal = 'false' @close="closeDialog" @open="open" width="63%">
      <h2>{{previewDate.title}}</h2>
      <div class="title">
        <span>{{previewDate.createTime|parseTimeByString}}</span>
        <span>{{previewDate.username}}</span>
        <i class="el-icon-view"></i>
        <span>{{previewDate.visits}}</span>
      </div>
      <div class="content" v-html="previewDate.articleBody"></div>
    </el-dialog>
   </div>
 </template>

<script>
export default {
  props: {
    previewDialog: {
      type: Boolean,
      default: false
    },
    previewDate: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    closeDialog () {
      this.$emit('update:previewDialog', false)
    },
    open () {
      console.log(this.previewDate)
    }
  }
}
</script>

 <style lang="scss" scoped>
h2{
  margin-top: 10px;
  margin-left: -5px;
  line-height: 0;
  font-size: 22px;
  padding-bottom: 3px;
}
.title{
  margin-left: 10px;
   padding-bottom:10px;
}
.title span{
  margin-right: 8px;
}
.title i {
  margin-right: 5px;
}
.content{
  border-top:1px dashed #ccc;
  padding: 10px;
  background-color: #f1f0f0;
}

 </style>
